package com.example.annotation;

import org.junit.Test;

import java.lang.reflect.Method;

/*
 * 重复注解与类型注解
 */
public class TestAnnotation {

    @Test
    public void test1() throws NoSuchMethodException {
        Class<TestAnnotation> annotationClass = TestAnnotation.class;
        Method show = annotationClass.getMethod("show");
        MyAnnotation[] annotationsByType = show.getAnnotationsByType(MyAnnotation.class);
        for (MyAnnotation annotation : annotationsByType) {
            System.out.println(annotation.value());
        }
    }


    @MyAnnotation("Hello")
    @MyAnnotation("World")
    public void show(String str) {

    }

    //类型注解

    public void show1(@MyAnnotation("abc") String str) {

    }

    //checker framework
    private /*@NonNull*/ Object obj = null;
}
